package com.wissen.inharitance;

/**
 * @author wissen16
 * Marks is inherited class by Student class having math1,2,3 attributes
 * and get and print marks methods
 */
class Marks extends Student {    //Inheritance
	private int m1,m2,m3;  //Encapsulation
	/**
	 * this method to read marks of students
	 */
	public void get_marks() {
		try {
	System.out.print("Enter Student Marks for 3 Subject:");
	m1=Integer.parseInt(super.in.readLine());
	m2=Integer.parseInt(super.in.readLine());
	m3=Integer.parseInt(super.in.readLine());
		}
		catch(Exception ex){
			System.out.println(ex.getMessage());  
		}
	}
	/**
	 * this method to print marks of students
	 */
 	public void print_marks(){
 		System.out.println("M1:"+m1);
 		System.out.println("M2:"+m2);
 		System.out.println("M3:"+m3);
 		System.out.println("Total:"+(m1+m2+m3));
 		System.out.println("Percentage:"+((m1+m2+m3)/3));
	}
}
